/**
 * @Author 韦建韩
 * @Date 2022/8/8
 */
package com.example.devops.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class RedisUtil {
    @Autowired
    RedisTemplate redisTemplate;

    private static  ValueOperations redis;
    @PostConstruct
    public void init(){
        redis = redisTemplate.opsForValue();
    }

    public String getkey(String key){
        return (String)redis.get(key);
    }
    public void setValue(String key, String value){
        redis.set(key, value);
    }
}
